<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>图书详情</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!-- 新 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/
    bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/resources/plugins/bootstrap/css/bootstrap.min.css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/frontcss/book/book.css">
  </head>
  
  
  <body>
     <div id="menu" class="topmenu">
		<%@ include file="../menu.jsp" %>
     </div>
     <div class="myblock" style="padding-top:104px;"></div>
    <div class="container">
        <table class="table" align="center">
            <tr height="300">
                <td class="tdBook" style="border-bottom-width: 0px;">
                <!--   图书详情区  -->
                    <div class="bookdesc">
                        <table class="booktable">
                            <tr>
                                <td class="bookimg">
                                   <a href="">
                                   	   <img style="opacity: 1;" title="" class="medium" width="300" height="360" src="${ pageContext.request.contextPath }/<s:property value="model.image"/>">
                                       <img src="${pageContext.request.contextPath}/resources/images/bookimages/%E6%96%87%E5%AD%A601.jpg" alt="" width="300" height="360">
                                   </a> 
                                </td>
                                <td class="bookinfo1">
                                    <h2><div class="name"><s:property value="model.pname"/></div></h2>
                                    <div class="sn">
                                        <div>编号：<s:property value="model.pid"/></div>
                                    </div>
                                    <br/>
                                    <div class="info" style="background-color:#bfbbbb;height:150px;width:480px;">
                                            <dl>
                                                <dt>图书介绍:</dt>
                                                <dd>
                                                    
                                                </dd>
                                            </dl>
                                    </div>
                                    <hr width = "100%" size = "20" noshade style="margin-left:-15px;">
                                    <div>
                                        <p style="float:left;">上传者：<s:property value="model.pname"/></p><button type="button" class="btn btn-info" >关注</button>
                                    </div>
                                    <br/>
                                    <div class="bookdata" display="inline" style="border:2px dotted #867575;">
                                        <ul>
                                            <li>被借阅次数：</li>
                                            <li style="padding-left:40px;">累计评论：</li>
                                            <li style="padding-left:40px;">获得积分：</li>
                                        </ul>
                                    </div>
                                    
                                    <form id="cartForm" action="${ pageContext.request.contextPath }/cart_addCart.action" method="post" >
                                        <input type="hidden" name="pid" value="<s:property value="model.pid"/>"/>
                                            <div class="buy">
                                                    <input id="connect" class="connect btn btn-info" value="立即联系" type="button" onclick="connect()"/>
                                                    <input id="addCart" class="addCart btn btn-info" value="加入购物车" type="button" onclick="saveCart()"/>
                                            </div>
                                    </form>
                                </td>
                            </tr>

                        </table>
                    </div>

                <!--     评论区    -->
                    <h1>评论区</h1>
                    <hr width = "100%" size = "20" noshade>
                    <div class="comment" >
                <!--      从数据库中选出点赞书排名前8的评论         -->
                        <div class="highcomments">
                            <ul style="display: block;">
                                <s:iterator var="p" value="hList">
									<li>
									    <img src="${pageContext.request.contextPath}/<s:property value="#p.image"/>" alt="" style="display: block;">
									    <span><s:property value="model.pname"/></span>
									    <span id="hcomments"></span>
									</li>
                                <hr width = "100%" size = "20" noshade>
							    </s:iterator>
                            </ul>
                        </div>
                <!--      按时间显示最新评论         -->
                        <div class="newcomments">
                            <ul style="display: block;">
                                <s:iterator var="p" value="nList">
									<li>
									    <img src="${pageContext.request.contextPath}/<s:property value="#p.image"/>" alt="" style="display: block;">
									    <span><s:property value="model.pname"/></span>
									    <span id="ncomments"></span>
									</li>
                                    <hr width = "100%" size = "20" noshade>
							    </s:iterator>
                            </ul>
                        </div>
                    <!--         分页          -->
                       
                        <div class="pagination">
                                <span>第 <s:property value="pageBean.page"/>/<s:property value="pageBean.totalPage"/> 页</span>
                            <s:if test="cid != null">
                                <s:if test="pageBean.page != 1">
                                    <a href="${ pageContext.request.contextPath }/product_findByCid.action?cid=<s:property value="cid"/>&page=1" class="firstPage">&nbsp;</a>
                                    <a href="${ pageContext.request.contextPath }/product_findByCid.action?cid=<s:property value="cid"/>&page=<s:property value="pageBean.page-1"/>" class="previousPage">&nbsp;</a>
                                </s:if>

                                <s:iterator var="i" begin="1" end="pageBean.totalPage">
                                    <s:if test="pageBean.page != #i">
                                        <a href="${ pageContext.request.contextPath }/product_findByCid.action?cid=<s:property value="cid"/>&page=<s:property value="#i"/>"><s:property value="#i"/></a>
                                    </s:if>
                                    <s:else>
                                        <span class="currentPage"><s:property value="#i"/></span>
                                    </s:else>
                                </s:iterator>

                                <s:if test="pageBean.page != pageBean.totalPage">	
                                    <a class="nextPage" href="${ pageContext.request.contextPath }/product_findByCid.action?cid=<s:property value="cid"/>&page=<s:property value="pageBean.page+1"/>">&nbsp;</a>
                                    <a class="lastPage" href="${ pageContext.request.contextPath }/product_findByCid.action?cid=<s:property value="cid"/>&page=<s:property value="pageBean.totalPage"/>">&nbsp;</a>
                                </s:if>
                            </s:if>	
                            <s:if test="csid != null">
                                <s:if test="pageBean.page != 1">
                                    <a href="${ pageContext.request.contextPath }/product_findByCsid.action?csid=<s:property value="csid"/>&page=1" class="firstPage">&nbsp;</a>
                                    <a href="${ pageContext.request.contextPath }/product_findByCsid.action?csid=<s:property value="csid"/>&page=<s:property value="pageBean.page-1"/>" class="previousPage">&nbsp;</a>
                                </s:if>

                                <s:iterator var="i" begin="1" end="pageBean.totalPage">
                                    <s:if test="pageBean.page != #i">
                                        <a href="${ pageContext.request.contextPath }/product_findByCsid.action?csid=<s:property value="csid"/>&page=<s:property value="#i"/>"><s:property value="#i"/></a>
                                    </s:if>
                                    <s:else>
                                        <span class="currentPage"><s:property value="#i"/></span>
                                    </s:else>
                                </s:iterator>

                                <s:if test="pageBean.page != pageBean.totalPage">	
                                    <a class="nextPage" href="${ pageContext.request.contextPath }/product_findByCsid.action?csid=<s:property value="csid"/>&page=<s:property value="pageBean.page+1"/>">&nbsp;</a>
                                    <a class="lastPage" href="${ pageContext.request.contextPath }/product_findByCsid.action?csid=<s:property value="csid"/>&page=<s:property value="pageBean.totalPage"/>">&nbsp;</a>
                                </s:if>
                            </s:if>	
                        </div>
                        
                    </div>
                </td>
                
                <td class="tdRight" width: 200px;>
                    <iframe frameborder="0" src="../book/recommend.html" name="left"></iframe>
                </td>
            </tr>
        </table>
    </div>
       
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
	<script src="${pageContext.request.contextPath}/resources/plugins/bootstrap/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/resources/plugins/bootstrap/js/bootstrap.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> 
  </body>
</html>
  